//
//  LicensePlateViewController.m
//  XinKaiFa55like
//
//  Created by junseek on 2017/3/22.
//  Copyright © 2017年 55like lj. All rights reserved.
//

#import "V4LicensePlateViewController.h"
#import "ProductKeysView.h"
#import "RHTableView.h"
#import "ButtonPullDown.h"
#import "LicensePlateTableViewCell.h"
#import "UILabel+atrribulttext.h"
#import "SelectTypeView.h"
#import "V4TestLicensePlateContentViewController.h"
#import "UserSupplyDemandViewController.h"
#import "UserProjectViewController.h"
#import "CompanyNoticeViewController.h"
//#import "JPUSHService.h"
#import "V4LicensePlateOtherTypeView.h"
#import "V4CityPopView.h"
#import "V4SelectView.h"
#import "ZviewDownlist.h"

@interface V4LicensePlateViewController ()<ProductKeysViewDelegate,RHTableViewDelegate>{
    UISearchBar *txtSearch;
    
    UIView *_viewTypeBG;
//    ButtonPullDown *btnType1;//行业
//    ButtonPullDown *btnType2;//城市
//    ButtonPullDown *btnType3;//类型
//    ButtonPullDown *btnType5;//其他
    
    NSMutableDictionary *selectDicType;
    
    RHTableView *table_user;
    
    UILabel *lblNum_header;
    
    NSString *strSearchKey;
    
    BOOL boolPopRefresh;
    NSInteger tipNum;
    
//    ButtonPullDown*_cityButton;
//    ButtonPullDown*_selectButton;
//    ButtonPullDown*_hangyeButton;
    
    
    SelectTypeView *selectType;
    
}
@property(nonatomic,copy)NSString*areaid;
@property(nonatomic,strong)NSMutableDictionary*selectRequestDic;
@property(nonatomic,copy)NSString*key;
@property(nonatomic,strong)ButtonPullDown*cityButton;
@property(nonatomic,strong)ButtonPullDown*selectButton;
@property(nonatomic,strong)ButtonPullDown*hangyeButton;;
@property(nonatomic,copy)NSString*cid;
@property(nonatomic,strong)NSDictionary*userTypeData;

@end

@implementation V4LicensePlateViewController

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    txtSearch.text=@"";
    //注册监听键盘事件

    //    RegisterNotify(@"JPushMessage", @selector(pushMessageData:))
    if (boolPopRefresh) {
        boolPopRefresh=NO;
        [table_user refresh];
    }
}

-(void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
    RemoveNofify
    //    [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil];
    //    [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillHideNotification object:nil];
}
-(void)dealloc{
    [[NSNotificationCenter defaultCenter] removeObserver:self];
}

-(void)addTypeView{
    UIView*contentViw=_viewTypeBG;
    
    if([self.userInfo isEqualToString:@"search"]){
    
        float fw=kScreenWidth/3;
        
        _hangyeButton=[[ButtonPullDown alloc] initWithFrame:CGRectMake(0, 0, fw, 40) withSel:@selector(menuBtnClick:) addTarget:self buttonTitle:@"行业"];
        [contentViw addSubview:_hangyeButton];
        _cityButton=[[ButtonPullDown alloc] initWithFrame:CGRectMake(fw, 0, fw, 40) withSel:@selector(menuBtnClick:) addTarget:self buttonTitle:@"全国"];
        [contentViw addSubview:_cityButton];
        _selectButton=[[ButtonPullDown alloc] initWithFrame:CGRectMake(2*fw, 0, fw, 40) withSel:@selector(menuBtnClick:) addTarget:self buttonTitle:@"筛选"];
        [contentViw addSubview:_selectButton];
    }else{
        float fw=kScreenWidth/2;
        _cityButton=[[ButtonPullDown alloc] initWithFrame:CGRectMake(0, 0, fw, 40) withSel:@selector(menuBtnClick:) addTarget:self buttonTitle:@"全国"];
        [contentViw addSubview:_cityButton];
        _selectButton=[[ButtonPullDown alloc] initWithFrame:CGRectMake(fw, 0, fw, 40) withSel:@selector(menuBtnClick:) addTarget:self buttonTitle:@"筛选"];
        [contentViw addSubview:_selectButton];
    
    }
    
//    NSArray*arraytitle=@[@"全国",@"筛选"];
//    float width=kScreenWidth/arraytitle.count;
//    for (int i=0; i<arraytitle.count; i++) {
//        NSString*titleStr=arraytitle[i];
//         WSSizeButton*btn1=[RHMethods buttonWithframe:CGRectMake(i*width, 0, width, contentViw.frameWidth) backgroundColor:nil text:titleStr font:14 textColor:nil radius:0 superview:contentViw];
//        [btn1 setImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
//        
//        [btn1 addTarget:self action:@selector(menuBtnClick:) forControlEvents:UIControlEventTouchUpInside];
//        if (i!=arraytitle.count-1) {
//            [RHMethods viewWithFrame:CGRectMake(btn1.frameXW-1, 12, 1, 16) backgroundcolor:rgb(153,153,153) superView:contentViw];
//        }
//        if ([titleStr isEqualToString:@"全国"]) {
//            _cityButton=btn1;
//        }else if([titleStr isEqualToString:@"筛选"]){
//            _selectButton=btn1;
//        }
//        
//    }

}

-(void)menuBtnClick:   (UIButton*)btn{
      __weak __typeof(self) weakSelf = self;
    V4CityPopView*cityview= [self getAddValueForKey:@"cityview"];
    
    V4SelectView*selectview= [self getAddValueForKey:@"selectview"];
    ZviewDownlist*_downlistView= [self getAddValueForKey:@"_downlistView"];
    cityview.hidden=YES;
    selectview.hidden=YES;
    
    
    [_downlistView removeFromSuperview];
    if (btn==_cityButton&&btn.selected==NO) {
        btn.selected=YES;
        _selectButton.selected=NO;
        _hangyeButton.selected=NO;
        cityview= [V4CityPopView showMeWithCallBackBlock:^(id data, int status, NSString *msg) {
            if (status!=200) {
                btn.selected=NO;
                return ;
            }
            weakSelf.areaid=[data objectForJSONKey:@"areaid"];
            [weakSelf loadTableData];
            [(ButtonPullDown*)btn setButtonTitle:[data objectForJSONKey:@"name"]];
            btn.selected=NO;
        }];
        [self setAddValue:cityview forKey:@"cityview"];
        
    }else if (btn==_selectButton&&btn.selected==NO) {
        btn.selected=YES;
        _cityButton.selected=NO;
        _hangyeButton.selected=NO;
        selectview= [V4SelectView showMeWithCallBackBlock:^(id data, int status, NSString *msg) {
            if (status!=200) {
                btn.selected=NO;
                return ;
            }
            weakSelf.selectRequestDic=data;
            [weakSelf loadTableData];
            btn.selected=NO;
            
        }];
        
        [self setAddValue:selectview forKey:@"selectview"];
    }else if (btn==_hangyeButton&&btn.selected==NO) {
    
    
            btn.selected=YES;
            [self getCataDataWithBlcok:^(id data, int status, NSString *msg) {
                
                
                NSMutableDictionary*dic=[NSMutableDictionary new];
                [dic setObject:btn.currentTitle forKey:@"currenttitle"];
                [dic setObject:[NSString stringWithFormat:@"%d",kTopHeight+40] forKey:@"y"];
                
                
                NSMutableArray*mtitlarray=[NSMutableArray new];
                
                NSArray*array=[self.userTypeData objectForKey:@"bigcate"];
                for (NSDictionary*dic in array) {
                    for (NSDictionary *subdic in [dic objectForJSONKey:@"list"]) {
                        NSMutableDictionary*submdic=[NSMutableDictionary dictionaryWithDictionary:subdic];
                        [submdic setObject:[subdic objectForKey:@"name"] forKey:@"title"];
                        
                        [mtitlarray addObject:submdic];
                    }
                }
                
                
                [ mtitlarray insertObject:@{@"title":@"全部行业"} atIndex:0];
                [dic setObject:mtitlarray forKey:@"titlearray"];
                
                ZviewDownlist*   _downlistView=  [ZviewDownlist showMeWithDic:dic CallBackBlock:^(id data, int status, NSString *msg) {
                    weakSelf.hangyeButton.selected=NO;
                    weakSelf.cityButton.selected=NO;
                    weakSelf.selectButton.selected=NO;
                    if (status==200) {
                        [weakSelf.hangyeButton setButtonTitle:[data objectForKey:@"title"]];
                        
                        //                weakSelf.selectRequestDic=data;
                        _cid=[data objectForKey:@"id"];
                        [weakSelf loadTableData];
                    }
                    
                }];
                [weakSelf setAddValue:_downlistView forKey:@"_downlistView"];
            }];
        
        
    
    }else{
        _cityButton.selected=NO;
        _selectButton.selected=NO;
        _hangyeButton.selected=NO;
    }
    
    
    
    
}

-(void)getCataDataWithBlcok:(AllcallBlock)block{
    if (self.userTypeData) {
        if (block) {
            
            block(self.userTypeData,200,nil);
        }
        return;
    }
    
    
     krequestParam
    if (_key) {
        if (_key) {
            [dictparam setObject:_key forKey:@"key"];
        }
//        if (_cid) {
////            [dictparam setObject:_cid forKey:@"cid"];
//        }
    }
    
    [NetEngine createPostAction:[NSString stringWithFormat:@"%@%@",XKFV4productscate,dictparam.wgetParamStr]  withParams:dictparam onCompletion:^(id resData, BOOL isCache) {
        if ([[resData getSafeObjWithkey:@"status"] isEqualToString:@"200"]) {
            NSDictionary *dic=[resData getSafeObjWithkey:@"data"];
            self.userTypeData=dic;
            block(dic,200,nil);
            
        }else{
            [SVProgressHUD showErrorWithStatus:[resData valueForJSONKey:@"info"]];
            
        }
    }];

}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    selectDicType=[NSMutableDictionary new];
    
    
    //    RegisterNotify(@"againLoadUserData", @selector(againLoadUserData))
    [self navbarTitle:@"   "];
//    [self rightButton:nil image:@"headsearch" sel:@selector(rightButtonClicked)];
    [self.navrightButton setTitleEdgeInsets:UIEdgeInsetsMake(0, 0, 0, 10)];
    self.backButton.frameWidth=50;
    self.navrightButton.frame=CGRectMake(kScreenWidth-50, 20, 50, 44);
    
    
    
    _viewTypeBG=[[UIView alloc] initWithFrame:CGRectMake(0, kTopHeight, kScreenWidth, 40)];
    _viewTypeBG.backgroundColor=[UIColor whiteColor];
    [self.view addSubview:_viewTypeBG];
    [self addTypeView];
    
    table_user=[[RHTableView alloc]initWithFrame:CGRectMake(0, YH(_viewTypeBG), kScreenWidth, H(self.view)-YH(_viewTypeBG))];
    [table_user showRefresh:YES LoadMore:YES];
    table_user.delegate = self;
    table_user.dataSource = self;
    table_user.delegate2=self;
    [table_user setBackgroundColor:rgbGray];
    [table_user setSeparatorStyle:UITableViewCellSeparatorStyleNone];
    [self.view addSubview:table_user];
    [table_user registerClass:[LicensePlateTableViewCell class] forCellReuseIdentifier:@"LicensePlateTableViewCell"];
    [table_user setAutoresizingMask:UIViewAutoresizingFlexibleHeight];
    
    
    if ([self.userInfo isEqualToString:@"search"]) {
        
        
//        [self.navrightButton setImage:nil forState:UIControlStateNormal];
        
        _key=[self.otherInfo objectForJSONKey:@"searchkey"];
//        [self navbarTitle:_key];
        [self addSearchView];
         [self loadTableData];
//        [self.navrightButton setTitle:@"取消" forState:UIControlStateNormal];
//        [self againLoadUserData];
        
    }else{
        txtSearch.hidden=YES;
        [selectDicType setValue:[self.otherInfo valueForJSONStrKey:@"id"] forKey:@"industry"];
//        [btnType1 setButtonTitle:[self.otherInfo valueForJSONStrKey:@"name"]];
        [self loadTableData];
        [self loadProductskeywords];
        strSearchKey=[self.otherInfo valueForJSONStrKey:@"name"];
    }
}

-(void)addSearchView{
      __weak __typeof(self) weakSelf = self;
    UIView*viewSeach=[RHMethods viewWithFrame:CGRectMake(44, 0, kScreenWidth-44-51, 30) backgroundcolor:zrgbwhiteColor superView:self.navView];
    viewSeach.frameBY=7;
    viewSeach.layer.borderColor=rgb(229,229,229).CGColor;
    viewSeach.layer.borderWidth=1;
    viewSeach.layer.cornerRadius=3;
    UIImageView*imgVicon=[RHMethods imageviewWithFrame:CGRectMake(10, 8, 16, 16) defaultimage:@"xkf_search" supView:viewSeach];
    
    UITextField*tfSearch=[RHMethods textFieldlWithFrame:CGRectMake(imgVicon.frameXW+8, 0, viewSeach.frameWidth-imgVicon.frameXW-8-8, viewSeach.frameHeight) font:Font(10) color:nil placeholder:@"请输入公司名称等关键字" text:@""];
    [viewSeach addSubview:tfSearch];
    tfSearch.userInteractionEnabled=NO;
    tfSearch.text=[self.otherInfo objectForKey:@"searchkey"];
    [viewSeach addViewClickBlock:^(UIView *view) {
        [weakSelf.navigationController popViewControllerAnimated:YES];
        
    }];
    
//    _searchTf=tfSearch;
    
    
//    tfSearch.delegate=self;
    
    
//    WSSizeButton*btnMe=[RHMethods buttonWithframe:CGRectMake(kScreenWidth-51, 0, 51, 30) backgroundColor:nil text:@"搜索" font:15 textColor:rgb(239,186,57) radius:0 superview:self.navView];
//    [btnMe addTarget:self action:@selector(bigenSearch) forControlEvents:UIControlEventTouchUpInside];
//    btnMe.frameRX=0;
//    btnMe.centerY=viewSeach.centerY;
}


#pragma mark selector
-(void)againLoadUserData{
    [selectDicType removeAllObjects];
    
    [[Utility Share] setIsUserLogin:YES];
    [[Utility Share] hiddenStartTransitionView];
    
    [self loadTableData];
    [self loadProductskeywords];
}
-(void)loadTableData{
    krequestParam
    [dictparam setValue:@"%@" forKey:@"page"];
    [dictparam setValue:@"20" forKey:@"pagesize"];
    [dictparam setValue:@"lists" forKey:@"type"];
    
//    [dictparam setValue:[selectDicType valueForJSONStrKey:@"industry"] forKey:@"cid"];
//    [dictparam setValue:[selectDicType valueForJSONStrKey:@"level"] forKey:@"level"];
//    [dictparam setValue:[selectDicType valueForJSONStrKey:@"type"] forKey:@"typeid"];
//    [dictparam setValue:[selectDicType valueForJSONStrKey:@"cityName"] forKey:@"city"];
//    
//    [dictparam setValue:[selectDicType valueForJSONStrKey:@"order"] forKey:@"order"];
    if (_areaid) {
        [dictparam setObject:_areaid forKey:@"city"];
    }
    if (_selectRequestDic) {
        [dictparam addEntriesFromDictionary:_selectRequestDic];
    }
    
    if ([[self.otherInfo valueForJSONStrKey:@"id"] notEmptyOrNull]) {
       [ dictparam setObject:[self.otherInfo valueForJSONStrKey:@"id"] forKey:@"cid"];
        
        UTILITY.CurrentCid=[self.otherInfo valueForJSONStrKey:@"id"];
        [self setAddValue:[self.otherInfo valueForJSONStrKey:@"id"] forKey:@"Cid"];
    }
    
    if (_key) {
        [dictparam setObject:_key forKey:@"key"];
        
        [self setAddValue:_key forKey:@"key"];
    }
    if (_cid) {
        [dictparam setObject:_cid forKey:@"cid"];
        UTILITY.CurrentCid=_cid;
        
        [self setAddValue:_cid forKey:@"Cid"];
    }
    
    //    if ([[selectDicType valueForJSONStrKey:@"sort"]isEqualToString:@"view"]) {
    //        [dictparam setValue:@"desc" forKey:@"viewsort"];
    //    }else if ([[selectDicType valueForJSONStrKey:@"sort"]isEqualToString:@"praise"]) {
    //        [dictparam setValue:@"desc" forKey:@"praisesort"];
    //    }
    
//    strSearchKey=txtSearch.text;
//    if (!txtSearch.hidden) {
//        [dictparam setValue:strSearchKey forKey:@"keys"];
//    }
    
    table_user.urlString=[NSString stringWithFormat:@"%@%@",XKFV4productslists,dictparam.wgetParamStr];
    [table_user refresh];
}
-(void)loadProductskeywords{
    [NetEngine createGetAction_LJ_two:[NSString stringWithFormat:XKFproductskeywords,[[Utility Share] userId],[[Utility Share] userToken],@""] onCompletion:^(id resData, BOOL isCache) {
        if ([[resData valueForJSONStrKey:@"status"] isEqualToString:@"200"]) {
            [[Utility Share] setArrayProductKeys:[[resData objectForJSONKey:@"data"] objectForJSONKey:@"list"]];
        }else{
            [self loadProductskeywords];
        }
    } onError:^(NSError *error) {
        [self loadProductskeywords];
    }];
}
-(void)rightButtonClicked{
    if (txtSearch.hidden) {
        txtSearch.hidden=NO;
        [self.navrightButton setImage:nil forState:UIControlStateNormal];
        [self.navrightButton setTitle:@"取消" forState:UIControlStateNormal];
    }else{
        txtSearch.hidden=YES;
        [self.navrightButton setImage:[UIImage imageNamed:@"headsearch"] forState:UIControlStateNormal];
        [self.navrightButton setTitle:nil forState:UIControlStateNormal];
    }
}
#pragma mark RHTableViewDelegate
-(void)refreshData:(RHTableView *)view{
    if (view.dataDic) {
        tipNum=[[view.dataDic valueForJSONStrKey:@"unreadnum"] integerValue];
        //tipNum
        [self refreshTabBarTipData];
    }
}
-(void)refreshTabBarTipData{
    UILabel *lblTip=[[[[Utility Share] CustomTabBar_zk] tabBar] viewWithTag:200];
    if (tipNum>0) {
        lblTip.hidden=NO;
        if (tipNum>99) {
            lblTip.text=@"99+";
        }else{
            lblTip.text=[NSString stringWithFormat:@"%ld",tipNum];
        }
        float fw=[lblTip sizeThatFits:CGSizeMake(MAXFLOAT, H(lblTip))].width+8;
        fw=fw<H(lblTip)?H(lblTip):fw;
        lblTip.frameWidth=fw;
    }else{
        lblTip.hidden=YES;
    }
}
#pragma mark Keyboard

#pragma mark button
#pragma mark SelectTypeViewDelegate

#pragma mark - tableView
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [table_user.dataArray  count];
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
//    NSDictionary *dic=[table_user.dataArray objectAtIndex:indexPath.row];
//    float fth=[self heightForLabel:kScreenWidth-50 font:fontTitle text:[dic valueForJSONStrKey:@"stitle"]];
//    fth = fth>20?40:20;
//    return fth+65;
    return 94+4.5;
}
- (UITableViewCell *)tableView:(RHTableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
//    if(tableView ==_mtableView){
        //
        UITableViewCell * cell =[tableView dequeueReusableCellWithIdentifier:@"cell"];
        
        if (cell == nil) {
            cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
            cell.selectionStyle = UITableViewCellSelectionStyleNone ;
            cell.frameWidth=kScreenWidth;
            cell.backgroundColor=zrgbwhiteColor;
            UILabel*lbtitle=[RHMethods lableX:10 Y:16 W:kScreenWidth-20 Height:14 font:14 superview:cell withColor:nil text:@"上海梧桐融资租赁有限公司（简称梧桐公司）"];
            UILabel*lbleft1=[RHMethods lableX:25 Y:lbtitle.frameYH+ 15 W:kScreenWidth/2-25-10 Height:12 font:12 superview:cell withColor:rgb(102,102,102) text:@"售价：30万  "];
            UILabel*lbleft2=[RHMethods lableX:25 Y:lbleft1.frameYH+10   W:kScreenWidth/2-25-10 Height:12 font:12 superview:cell withColor:rgb(102,102,102) text:@"成立时间：2017-1-1"];
            UILabel*lbright1=[RHMethods lableX:kScreenWidth/2 Y:lbleft1.frameY W:kScreenWidth/2-10 Height:12 font:12 superview:cell withColor:rgb(102,102,102) text:@"注册资本：300万"];
            UILabel*lbright2=[RHMethods lableX:kScreenWidth/2 Y:lbleft2.frameY W:kScreenWidth/2-10 Height:12 font:12 superview:cell withColor:rgb(102,102,102) text:@"发布时间：2017-6-1"];
            UIView*viewlin=[RHMethods viewWithFrame:CGRectMake(0, 93.5, kScreenWidth, 5) backgroundcolor:rgbGray superView:cell];
            tableView.backgroundColor=rgbGray;
            
            UIImageView* imageRedV=[RHMethods imageviewWithFrame:CGRectMake(0, 7+2, 10, 10) defaultimage:@"redTip070116" contentMode:UIViewContentModeCenter];
            [cell addSubview:imageRedV];
            
            [cell setAddValue:lbtitle forKey:@"lbtitle"];
            [cell setAddValue:lbleft1 forKey:@"lbleft1"];
            [cell setAddValue:lbleft2 forKey:@"lbleft2"];
            [cell setAddValue:lbright1 forKey:@"lbright1"];
            [cell setAddValue:lbright2 forKey:@"lbright2"];
            [cell setAddValue:viewlin forKey:@"viewlin"];
            [cell setAddValue:imageRedV forKey:@"imageRedV"];
            
            
        }
        UILabel*lbtitle=[cell getAddValueForKey:@"lbtitle"];
        UILabel*lbleft1=[cell getAddValueForKey:@"lbleft1"];
        UILabel*lbleft2=[cell getAddValueForKey:@"lbleft2"];
        UILabel*lbright1=[cell getAddValueForKey:@"lbright1"];
        UILabel*lbright2=[cell getAddValueForKey:@"lbright2"];
        UILabel*imageRedV=[cell getAddValueForKey:@"imageRedV"];
        
        NSDictionary *dic=tableView.dataArray[indexPath.row];
        lbtitle.text=[dic objectForJSONKey:@"title"];
        imageRedV.frameX=lbtitle.frameX+[lbtitle.text widthWithFont:14];
        imageRedV.hidden=[[dic valueForJSONStrKey:@"isread"] isEqualToString:@"1"];
        lbleft1.text=[NSString stringWithFormat:@"售价：%@",[dic objectForJSONKey:@"price"]];
        lbright1.text=[NSString stringWithFormat:@"注册资本：%@",[dic objectForJSONKey:@"regcapital"]];
        lbleft2.text=[NSString stringWithFormat:@"成立时间：%@",[dic objectForJSONKey:@"regtime"]];
        lbright2.text=[NSString stringWithFormat:@"发布时间：%@",[dic objectForJSONKey:@"ctime"]];
    if ([self.userInfo isEqualToString:@"search"]) {
        [lbtitle setColor:rgb(239,186,58) contenttext:[self.otherInfo objectForJSONKey:@"searchkey"]];
    }
        
        return cell;
//        
//    }
//    return [UITableViewCell new];
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    [self.view endEditing:YES];
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    NSMutableDictionary *dic=[[NSMutableDictionary alloc] initWithDictionary:[table_user.dataArray objectAtIndex:indexPath.row]];
    [self pushController:[V4TestLicensePlateContentViewController class] withInfo:@"Insurance" withTitle:@"牌照详情" withOther:dic];
    if ([[dic valueForJSONStrKey:@"isread"] isEqualToString:@"0"]) {
        [dic setValue:@"1" forKey:@"isread"];
        [table_user.dataArray replaceObjectAtIndex:indexPath.row withObject:dic];
        [table_user reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
        tipNum--;
        [self refreshTabBarTipData];
    }
    
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 30;
}
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    UIView *viewBG=[[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 30)];
    viewBG.backgroundColor=rgbGray;
    lblNum_header=[RHMethods labelWithFrame:CGRectMake(10, 7, kScreenWidth, 20) font:fontSmallTitle color:rgbTxtGray text:[NSString stringWithFormat:@"当前：%@ 数据",[table_user.dataDic valueForJSONStrKey:@"total"]]];
    [lblNum_header setColor:rgbpublicColor contenttext:[table_user.dataDic valueForJSONStrKey:@"total"]];
    [viewBG addSubview:lblNum_header];
    return viewBG;
}

#pragma mark UISearchBarDelegate


/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end
